#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "qipan.h"
#include "gamelogic.h"
#include <QMap>
#include <QPair>
#include <QTimer>
#include "client.h"
#include "myclientsocket.h"
#include "handlemessage.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(MyClientSocket * socket,Mode mode,handlemessage * handlemessage,QWidget *parent = nullptr);
    ~MainWindow();
    //static int pvp_flag;

private:



public slots:
    void handleChessClickSlot(int row,int col);
    void handleAiChessPosSlot(int row,int col);
    void handleRecvPlay(QVector<int> &data);
    void handleRecvBack(QString status);

private:
    Ui::MainWindow *ui;

    /* 棋盘 */
    qipan *m_qipan;

    /* 游戏规则 */
    Gamelogic * m_logic;

    void printBoard();

    QMap<int,QVector<int>> m_map;

    int m_stepCount;

    int m_count;

    QTimer * timer;

    //Client * m_socket;
    MyClientSocket * m_socket;

    bool m_player;

    Mode m_mode;

    handlemessage * m_handlemessage;

    int pvp_flag;

    int playFlag;

};

#endif // MAINWINDOW_H
